#ifndef _CELL_H_
#define _CELL_H_

#include "ht32.h"

#define CELL1_TIM  HT_GPTM0
#define CELL1_2_TIM HT_GPTM1

#define CELL2_TIM HT_MCTM0

#define CELL1 1
#define CELL2 2
#define UP_ 1
#define DO_ 0

#define ESP_HEAD 0X5A
#define ESP_TAIL 0XA5

#define RX_BUFF_LONG 20
#define RX_CHECK_OK 12
#define RX_DATA_NEED 8

#define HT_NOW_CHAH 2


typedef void (* cell_set_pin)(HT_TM_TypeDef* TMx, TM_CH_Enum TM_CH_n, u16 Cmp);

typedef struct{
	uint8_t head; //0x5a
	uint8_t HT_CH;//三个HT单片机 第一个为1
	uint8_t CELL_CH:2;//一个HT有两个CELL, 第一个为1
	uint8_t pin_0 :1;
	uint8_t pin_1 :1;
	uint8_t pin_2 :1;
	uint8_t pin_3 :1;
	uint8_t pin_4 :1;
	uint8_t pin_5 :1;
	uint8_t tail; //0xa5        //设置如下|0 5| 
	
	uint8_t _2_head; //0x5a
	uint8_t _2_HT_CH;//三个HT单片机 第一个为1
	uint8_t _2_CELL_CH:2;//一个HT有两个CELL, 第一个为1
	uint8_t _2_pin_0 :1;
	uint8_t _2_pin_1 :1;
	uint8_t _2_pin_2 :1;
	uint8_t _2_pin_3 :1;
	uint8_t _2_pin_4 :1;
	uint8_t _2_pin_5 :1;
	uint8_t _2_tail; //0xa5     //设置如下|0 3|     
}esp_inf_t;	//					设置如下  |1 4|
            //                  设置如下  |2 5|
typedef struct{
	uint16_t pin1_pwm;
	uint16_t pin2_pwm;
	uint16_t pin3_pwm;
	uint16_t pin4_pwm;
	uint16_t pin5_pwm;
	uint16_t pin6_pwm;
}cell_pwm_t;

typedef struct{
	uint8_t cell_name;

	uint8_t pin1_status:1;
	uint8_t pin2_status:1;
	uint8_t pin3_status:1;
	uint8_t pin4_status:1;
	uint8_t pin5_status:1;
	uint8_t pin6_status:1;//0 无显示   1是凸起

	cell_pwm_t pin_pwm_u;
	cell_pwm_t pin_pwm_d;
	
	esp_inf_t  pin_u_or_d;
	cell_set_pin set_pin;


}cell_inf_t;

extern esp_inf_t esp_get;
extern cell_inf_t cell_1_inf,cell_2_inf;
void init_cell_fun(void);
void get_cell_inf(void);
void set_cell_inf(cell_inf_t *cell_go);

#endif 

